<template>
  <el-container>
    <el-header>
      <my-header></my-header>
    </el-header>
    <el-container>
      <el-aside width="200px">
        <MyNav></MyNav>
      </el-aside>
      <el-main>

        <el-breadcrumb separator-class="el-icon-arrow-right">
          <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
          <el-breadcrumb-item>{{text}}</el-breadcrumb-item>

        </el-breadcrumb>

        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
  import myHeader from "../components/MyHeader";
  import MyNav from '../components/MyNav'
  import * as api from '../utils/api'
  export default {
    name: 'home',
    components: {
      myHeader,
      MyNav
    },

    watch:{
      $route(to, from) {
        // console.log(window.location.href);
        console.log(this.$route.path);
        if (this.$route.path==='/home/table'){
          this.text='餐桌管理'
        }else if (this.$route.path==='/home/menu'){
          this.text='菜品管理'
        }else if (this.$route.path==='/home/diancai'){
          this.text='点餐管理'
        }else if (this.$route.path==='/home/vip'){
          this.text='会员管理'
        }else if (this.$route.path==='/home/shouyin'){
          this.text='收银'
        }else if (this.$route.path==='/home/people'){
          this.text='人员管理'
        }else {
          this.text=''
        }
      }
    },

    data() {
      return {
         text:''
      }
    },

  }
</script>

<style lang='less' scoped>
  .el-header {
    background-color: white;
    color: #333;
    height: 10vh;
    h1 {
      text-align: center;
      margin: 0;
      line-height: 60px;
    }
  }

  .el-aside {
    background-color: rgba(236,148,141,.2);
    color: #333;
    text-align: center;
    line-height: 200px;
    height: 90vh;
  }

  .el-main {
    background-color: rgba(236,148,141,.1);
    color: #333;
    text-align: center;
  }
</style>